package com.htandroid.htandroid.webservice;

import java.util.ArrayList;

import org.xmlpull.v1.XmlSerializer;


import android.util.Xml;

import com.htandroid.htandroid.entity.MrqgdSpListDetail;
import com.htandroid.htandroid.entity.UffjqgdList_detail;
import com.htandroid.htandroid.sys.Basenvo;

//生成xml的文本信息
public class BuildMrqgdSpDetailXMLService {

    public String buildXML(ArrayList<MrqgdSpListDetail> mrqgdlist, String methodName, String namespace, String[] param, String[] val, String param_o) {
        String xmlstring = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body>";
        //添加方法名
        xmlstring = xmlstring + "<" + methodName + " xmlns=\"" + namespace + "\"> \r\n";
        //前参
        for (int i = 0; i < param.length; i++) {
            xmlstring = xmlstring + "<" + param[i] + ">" + val[i] + "</" + param[i] + "> \r\n";
        }
        if (mrqgdlist != null) {
            //对象参数
            xmlstring = xmlstring + "<" + param_o + ">\r\n";
            for (int i = 0; i < mrqgdlist.size(); i++) {
                MrqgdSpListDetail mrqgds = mrqgdlist.get(i);
                xmlstring = xmlstring + "<MrqgdSpDetailList xmlns=\"http://entity.test.com\">\r\n";//必须指定映射文件所在的路径,否则webservice默认的是当前路径
                xmlstring = xmlstring + "<cvouchid>" + Basenvo.AdjDigest(mrqgds.getCvouchid()) + "</cvouchid>\r\n";
                xmlstring = xmlstring + "<cinvcode>" + Basenvo.AdjDigest(mrqgds.getCinvcode()) + "</cinvcode>\r\n";
                xmlstring = xmlstring + "<cinvname>" + Basenvo.AdjDigest(mrqgds.getCinvname()) + "</cinvname>\r\n";
                xmlstring = xmlstring + "<cinvstd>" + Basenvo.AdjDigest(mrqgds.getCinvstd()) + "</cinvstd>\r\n";
                xmlstring = xmlstring + "<cinvm_unit>" + Basenvo.AdjDigest(mrqgds.getCinvm_unit()) + "</cinvm_unit>\r\n";
                xmlstring = xmlstring + "<ddhdate>" + Basenvo.AdjDigest(mrqgds.getDdhdate()) + "</ddhdate>\r\n";
                xmlstring = xmlstring + "<inid>" + Basenvo.AdjDigest(mrqgds.getInid()) + "</inid>\r\n";
                xmlstring = xmlstring + "<ixyprice>" + Basenvo.AdjDigest(mrqgds.getIxyprice()) + "</ixyprice>\r\n";
                xmlstring = xmlstring + "<bxyprice>" + Basenvo.AdjDigest(mrqgds.getBxyprice()) + "</bxyprice>\r\n";
                xmlstring = xmlstring + "<border>" + Basenvo.AdjDigest(mrqgds.getBorder()) + "</border>\r\n";
                xmlstring = xmlstring + "<bclose>" + Basenvo.AdjDigest(mrqgds.getBclose()) + "</bclose>\r\n";
                xmlstring = xmlstring + "<cmemo>" + Basenvo.AdjDigest(mrqgds.getCmemo()) + "</cmemo>\r\n";
                xmlstring = xmlstring + "<iquantity>" + Basenvo.AdjDigest(mrqgds.getIquantity()) + "</iquantity>\r\n";
                xmlstring = xmlstring + "<iqgq>" + Basenvo.AdjDigest(mrqgds.getIqgq()) + "</iqgq>\r\n";
                xmlstring = xmlstring + "<iprice>" + Basenvo.AdjDigest(mrqgds.getIprice()) + "</iprice>\r\n";
                xmlstring = xmlstring + "<iamount>" + Basenvo.AdjDigest(mrqgds.getIamount()) + "</iamount>\r\n";
                xmlstring = xmlstring + "<ids>" + Basenvo.AdjDigest(mrqgds.getIds()) + "</ids>\r\n";
                xmlstring = xmlstring + "<cinvccode>" + Basenvo.AdjDigest(mrqgds.getCinvccode()) + "</cinvccode>\r\n";
                xmlstring = xmlstring + "<mrqgds_id>" + Basenvo.AdjDigest(mrqgds.getMrqgds_id()) + "</mrqgds_id>\r\n";
                xmlstring = xmlstring + "<autoid>" + Basenvo.AdjDigest(mrqgds.getAutoid()) + "</autoid>\r\n";
                xmlstring = xmlstring + "<cchecker>" + Basenvo.AdjDigest(mrqgds.getCchecker()) + "</cchecker>\r\n";
                xmlstring = xmlstring + "<ccheckdate>" + Basenvo.AdjDigest(mrqgds.getCcheckdate()) + "</ccheckdate>\r\n";
                xmlstring = xmlstring + "<cdisapprovereason>" + Basenvo.AdjDigest(mrqgds.getCdisapprovereason()) + "</cdisapprovereason>\r\n";
                xmlstring = xmlstring + "<cdefine1>" + Basenvo.AdjDigest(mrqgds.getCdefine1()) + "</cdefine1>\r\n";
                xmlstring = xmlstring + "<cdefine2>" + Basenvo.AdjDigest(mrqgds.getCdefine2()) + "</cdefine2>\r\n";
                xmlstring = xmlstring + "<cdefine3>" + Basenvo.AdjDigest(mrqgds.getCdefine3()) + "</cdefine3>\r\n";
                xmlstring = xmlstring + "<cdefine4>" + Basenvo.AdjDigest(mrqgds.getCdefine4()) + "</cdefine4>\r\n";
                xmlstring = xmlstring + "<bapprove>" + Basenvo.AdjDigest(mrqgds.getBapprove()) + "</bapprove>\r\n";
                xmlstring = xmlstring + "<inorder>" + Basenvo.AdjDigest(mrqgds.getInorder()) + "</inorder>\r\n";
                xmlstring = xmlstring + "<bclose>" + Basenvo.AdjDigest(mrqgds.getBclose()) + "</bclose>\r\n";
                xmlstring = xmlstring + "<succount>" + Basenvo.AdjDigest(mrqgds.getSuccount()) + "</succount>\r\n";
                xmlstring = xmlstring + "</MrqgdSpDetailList>\r\n";
            }
            xmlstring = xmlstring + "</" + param_o + ">\r\n";
        }
        xmlstring = xmlstring + "</" + methodName + ">\r\n";
        xmlstring = xmlstring + "</soap:Body></soap:Envelope>";
        return xmlstring;
    }
}
